<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link href="../static/css/prism.css" rel="stylesheet" />
</head>

<body>
    <h2>Array.isArray(param) 判断参数是否为数组</h2>
    <p style="font-family: Kaiti;">可以弥补`typeof`运算符的不足</p>

    <pre><code class="language-javascript">var arr = ["尚学堂", 100, true];
console.log(typeof arr); // object</code></pre>

    <pre><code class="language-javascript">var arr = ['sxt', 'baizhan', 'it'];
Array.isArray(arr) // true</code></pre>

    <script src="../static/js/prism.min.js"></script>

    <script>
        console.log("练习开始");
        var arr = ["尚学堂", 100, true];
        var str = "itbaizhan";
        console.log(typeof arr);
        console.log(Array.isArray(arr));
        console.log(typeof str);
        console.log(Array.isArray(str));
    </script>
</body>

</html>